CFLAGS = -Wall -g
INCLUDES = -Iinclude

all: tbsserver

tbsserver: main.c protocol.o process.o log.o user.o ticket.o
	gcc $(CFLAGS) $(INCLUDES) -lncurses -o tbsserver $^

protocol.o: protocol.c include/protocol.h 
	gcc $(CFLAGS) $(INCLUDES) -c protocol.c

process.o: process.c include/process.h	
	gcc $(CFLAGS) $(INCLUDES) -c process.c

test: test.c protocol.o process.o log.o user.o ticket.o
	gcc $(CFLAGS) $(INCLUDES) -lncurses -o test $^
	
log.o: log.c include/log.h 
	gcc $(CFLAGS) $(INCLUDES) -c log.c

user.o: user.c include/user.h
	gcc $(CFLAGS) $(INCLUDES) -c user.c

ticket.o: ticket.c include/ticket.h
	gcc $(CFLAGS) $(INCLUDES) -c ticket.c
	
clean:
	rm protocol.o process.o log.o user.o ticket.o tbsserver test

